package com.irdstudio.apicenter.console.dm.module;

import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.irdstudio.apicenter.console.dm.AppFrameModule;
import com.irdstudio.apicenter.frame.maker.dm.SModulePageBase;
import com.irdstudio.apicenter.frame.maker.dm.SModuleParams;

@Service(value = "moduleService")
public class ModuleService {
	@Autowired
	private ModuleDao ModuleDao;

	/**
	 * 获取模块信息
	 * 
	 * @param id
	 * @param name
	 * @param pageNowe
	 * @param pageSiz
	 * @return
	 * @throws SQLException
	 * @throws ClassNotFoundException
	 */
	public List<ModuleEntity> queryModule(String sql) throws SQLException,
			ClassNotFoundException {

		return ModuleDao.queryModule(sql);

	}

	/**
	 * 获取单条信息的详细信息
	 * 
	 * @param id
	 * @return
	 * @throws SQLException
	 * @throws ClassNotFoundException
	 */

	public ModuleEntity queryModuleDetail(String id) throws SQLException,
			ClassNotFoundException {
		return ModuleDao.queryModuleDetail(id);

	}

	public List<SModuleParams> queryModuleParam(String id) throws SQLException,
			ClassNotFoundException {
		return ModuleDao.queryModuleParam(id);

	}

	/**
	 * 判断模块代码在库中是否存在
	 * 
	 * @param id
	 * @return
	 * @throws SQLException
	 * @throws ClassNotFoundException
	 */
	public int findId(String id) throws SQLException, ClassNotFoundException {
		return ModuleDao.findid(id);

	}

	/**
	 * 新增模块
	 * 
	 * @param id
	 * @return
	 * @throws SQLException
	 * @throws ClassNotFoundException
	 */
	public int Addmodel(ModuleEntity id, List<SModuleParams> list)
			throws SQLException, ClassNotFoundException {
		return ModuleDao.Addmodel(id, list);

	}

	/**
	 * 删除信息
	 * 
	 * @param id
	 * @return
	 * @throws SQLException
	 * @throws ClassNotFoundException
	 */
	public int deletemodel(String id) throws SQLException,
			ClassNotFoundException {
		return ModuleDao.deletemodel(id);

	}

	/**
	 * 更新信息
	 * 
	 * @param id
	 * @return
	 * @throws SQLException
	 * @throws ClassNotFoundException
	 */
	public int updatemodelparam(String id, List<SModuleParams> list)
			throws SQLException, ClassNotFoundException {
		return ModuleDao.updatemodelparam(id, list);

	}

	public List<SModulePageBase> queryPageBase(String id) throws SQLException,
			ClassNotFoundException {
		return ModuleDao.queryPageBase(id);

	}

	public int updateModulePage(String id, List<SModulePageBase> list)
			throws SQLException, ClassNotFoundException {
		return ModuleDao.updateModulePage(id, list);

	}

	public List<SModulePageBase> modulepagelist() throws SQLException,
			ClassNotFoundException {
		return ModuleDao.modulepagelist();

	}
	
	public int insertModuleBase(ModuleEntity module) throws SQLException {
		return ModuleDao.insertModuleBase(module);
	}

}
